<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id$
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

/**
 * 队列，FIFO
 */
class dzf_base_queue extends dzf_base_class
{
	private $config;
	private $extension = array();
	private $queue;

	public function __construct() {
		$this->extension['redis'] = extension_loaded('redis');
	}

	/**
	 * 依据config当中设置，初始化队列信息
	 * @param unknown_type $config
	 */
	public function init($config) {
		$this->config = $config;

		// redis 接口
		if($this->extension['redis'] && !empty($config['redis']['server'])) {
			$this->queue = new dzf_memory_redis();
			$this->queue->init($this->config['redis']);
			if(!$this->queue->enable) {
				$this->queue = null;
			}
		}
		return $this->queue;
	}
}
